package cn.edu.sdjzu.knoverse.repository;

import cn.edu.sdjzu.knoverse.model.entity.kg.UserNode;
import org.springframework.data.neo4j.repository.Neo4jRepository;
import org.springframework.data.neo4j.repository.query.Query;

import java.util.List;
import java.util.Set;

public interface UserRepository extends Neo4jRepository<UserNode, Long> {

    // 按照用户userId 查询节点
    @Query("MATCH (u:User {userId: $userId}) RETURN u")
    UserNode findUserByUserId(Long userId);

    // 获取课程的所有教师
    @Query("MATCH (u:User)-[r:TEACH]->(c:Course) WHERE c.nodeId = $courseId RETURN u")
    Set<UserNode> queryUserByCourseId(Long courseId);
}
